#ifndef _AWUI_WINDOWS_EMULATORS_CHIP8_H
#define _AWUI_WINDOWS_EMULATORS_CHIP8_H

#include <awui/Windows/Forms/Button.h>

namespace awui {
	namespace Drawing {
		class Image;
	}

	namespace Emulation {
		namespace Chip8 {
			class CPU;
		}
	}

	namespace OpenGL {
		class GL;
	}

	using namespace awui::Emulation::Chip8;
	using namespace awui::Windows::Forms;

	namespace Windows {
		namespace Emulators {
			class Chip8 : public Button {
				private:
					CPU * _cpu;
					Drawing::Image * _image;
					bool _invertedColors;

					int ConvertKeyAwToChip8(Keys::Enum key);
					void AdjustSizeOfChip8();

				public:
					Chip8();
					virtual ~Chip8();

					virtual int IsClass(Classes::Enum objectClass) const;

					void LoadRom(const String file);

					virtual void OnTick();
					virtual void OnPaint(OpenGL::GL* gl);
					int GetChip8Mode();
					void SetInvertedColors(bool mode);

					virtual bool OnKeyPress(Keys::Enum key);
					virtual bool OnKeyUp(Keys::Enum key);
			};
		}
	}
}

#endif
